@extends('admin/layout')
@section('title','商品管理')
@section('introduce')
<script src="{{asset('admin/local/imageselect/imageselect.js')}}"></script>
<link rel="stylesheet" href="{{asset('admin/local/imageselect/imageselect.css')}}"/>
@stop
@section('content')
<!-- Content Header (Page header) -->
<section class="content-header">
  <h1>
    商品列表
    <small>更改商品</small>
  </h1>
  <ol class="breadcrumb">
  	<li><a href="{{asset('admin/index')}}"><i class="fa fa-th"></i> 管理首页</a></li>
    <li><i class="fa fa-shopping-cart"></i> 商品管理</li>
    <li><a href="{{asset('admin/product')}}"><i class="fa fa-list-ul"></i> 商品列表</a></li>
    <li class="active">更改商品</li>
  </ol>
</section>

<!-- Main content -->
<section class="content">
	<div class="row">
		<div class="col-md-12">
	  	  <!-- box start -->
          <div class="box box-info">
	        <div class="box-header with-border">
	          <h3 class="box-title"><i class="fa fa-cart-plus"> 更改商品</i></h3>
	        </div>
          
          @if(session('error'))
            {{session('error')}}
          @endif
          @if(count($errors)>0)
          <div class="alert alert-danger">
            <ul>
              @foreach($errors->all() as $error)
                <li>{{$error}}</li>
              @endforeach
            </ul>
          </div>
          @endif
          
            <!-- form start -->
            <form class="form-horizontal" id="main_form" action="/admin/product/{{$data->product_id}}" method="post" enctype="multipart/form-data">
              {{csrf_field()}}
              {{method_field('PUT')}}
              <input type="hidden" name="old_logo_pic" value="{{$data->logo_pic}}"/>
              <input type="hidden" name="old_ad_pic" value="{{$data->ad_pic}}"/>
              <div class="box-body">
                
                <div class="form-group {{--has-error--}}">
                  <label for="inputtitle" class="col-sm-2 col-md-2 control-label">商品标题：</label>
                  <div class="col-sm-6 col-md-5">
                    <input type="text" class="form-control" id="inputtitle" placeholder="请输入商品标题" name="title" value="{{$data->title}}">
                  </div>
                  <span class="help-block col-sm-4 col-md-5">
                  <!--
                  <i class="fa fa-times text-red"> </i>
                  -->
                  </span>
                </div>
                <div class="form-group">
                  <label for="inputtitle" class="col-sm-2 col-md-2 control-label">商品关键字：</label>
                  <div class="col-sm-6 col-md-5">
                    <input type="text" class="form-control" id="inputkeyword" name="title" value="{{$data->keyword}}" disabled>
                  </div>
                  <span class="help-block col-sm-4 col-md-5">
                  <!--
                  <i class="fa fa-times text-red"> </i>
                  -->
                  </span>
                </div>
                <div class="form-group {{--has-error--}}">
                  <label for="inputdes" class="col-sm-2 col-md-2 control-label">商品描述：</label>
                  <div class="col-sm-6 col-md-5">
                    <textarea class="col-sm-6 col-md-5 form-control" style="resize:none;height:100px;" name="description">{{$data->description}}</textarea>
                  </div>
                  <span class="help-block col-sm-4 col-md-5">
                  <!--<i class="fa fa-times text-red"> </i>-->
                  </span>
                </div>
                <div class="form-group">
                  <label for="inputmprice" class="col-sm-1 col-md-2 control-label" style="font-size:12px;">市场价：</label>
                  <div class="col-sm-3 col-md-2">
                    <input type="text" class="form-control" id="inputmprice" placeholder="请输入市场价" name="mprice" value="{{$data->mprice}}">
                  </div>
                  <label for="inputsprice" class="col-sm-1 col-md-1 control-label" style="font-size:12px;">商城价：</label>
                  <div class="col-sm-3 col-md-2">
                    <input type="text" class="form-control" id="inputsprice" placeholder="请输入商城价" name="sprice" value="{{$data->sprice}}">
                  </div>
                  <label for="inputlprice" class="col-sm-1 col-md-1 control-label" style="font-size:12px;">物流价：</label>
                  <div class="col-sm-3 col-md-2">
                    <input type="text" class="form-control" id="inputlprice" placeholder="请输入物流价" value="{{$data->lprice}}" name="lprice">
                  </div>
                </div>  
                <div class="form-group">
                  <label for="inputlogo" class="col-sm-2 col-md-2 control-label">LOGO图片：</label>
                  <div class="col-sm-2 col-md-2">
                    <img src="/uploads/product/logo_pic/{{$data->logo_pic}}" style="width:100px;height:100px;border:1px solid gray;"/>
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 col-md-2 control-label"></label>
                  <div class="col-sm-2 col-md-2">
                    <input type="file" name="logo_pic">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 col-md-2 control-label">广告图片：</label>
                  <div class="col-sm-2 col-md-2">
                    @if($data->ad_pic=='')
                    <div style="width:100px;height:100px;border:1px solid gray;text-align:center;font:20px/100px 黑体;">无</div>
                    @else
                    <img src="/uploads/product/ad_pic/{{$data->ad_pic}}" style="width:100px;height:100px;border:1px solid gray"/>
                    @endif
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 col-md-2 control-label"></label>
                  <div class="col-sm-2 col-md-2">
                    <input type="file" name="ad_pic">
                  </div>
                </div>
                <div class="form-group">
                  <label for="selectnew" class="col-sm-2 col-md-2 control-label">是否新品推荐：</label>
                  <div class="col-sm-4 col-md-3">
                    <select id="selectnew" class="form-control" name="new_recommended">
                      @if($data->new_recommended==1)
                      <option value="1" selected>否</option>
                      <option value="2">是</option>
                      @else
                      <option value="1">否</option>
                      <option value="2" selected>是</option>
                      @endif
                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <label for="selecthotsell" class="col-sm-2 col-md-2 control-label">是否热销推荐：</label>
                  <div class="col-sm-4 col-md-3">
                    <select id="selecthotsell" class="form-control" name="hotsell_recommended">
                      @if($data->hotsell_recommended==1)
                      <option value="1" selected>否</option>
                      <option value="2">是</option>
                      @else
                      <option value="1">否</option>
                      <option value="2" selected>是</option>
                      @endif
                      
                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <label for="selectboutique" class="col-sm-2 col-md-2 control-label">是否精品推荐：</label>
                  <div class="col-sm-4 col-md-3">
                    <select id="selectboutique" class="form-control" name="boutique_recommended">
                      
                      @if($data->boutique_recommended==1)
                      <option value="1" selected>否</option>
                      <option value="2">是</option>
                      @else
                      <option value="1">否</option>
                      <option value="2" selected>是</option>
                      @endif
                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <label for="selectdisabled" class="col-sm-2 col-md-2 control-label">上架状态：</label>
                  <div class="col-sm-4 col-md-3">
                    <select id="selectdisabled" class="form-control" name="disabled">
                      
                      @if($data->disabled==1)
                      <option value="1" selected>上架</option>
                      <option value="2">下架</option>
                      @else
                      <option value="1">上架</option>
                      <option value="2" selected>下架</option>
                      @endif
                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 col-md-2 control-label">发布时间：</label>
                  <label class="col-sm-2 col-md-2 control-label">
                    {{date('Y-m-d H:i:s',$data->rtime)}}
                  </label>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 col-md-2 control-label">库存数：</label>
                  <label class="col-sm-2 col-md-2 control-label">
                    {{$data->stocknum}}
                  </label>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 col-md-2 control-label">点击数：</label>
                  <label class="col-sm-2 col-md-2 control-label">
                    {{$data->chicknum}}
                  </label>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 col-md-2 control-label">收藏数：</label>
                  <label class="col-sm-2 col-md-2 control-label">
                    {{$data->collectnum}}
                  </label>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 col-md-2 control-label">销售数：</label>
                  <label class="col-sm-2 col-md-2 control-label">
                    {{$data->sellnum}}
                  </label>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 col-md-2 control-label">评分：</label>
                  <label class="col-sm-2 col-md-2 control-label">
                    {{$score}}
                  </label>
                </div>
              </div>
              <h3 class="text-center">属性</h3>
              <!--
              <div class="row">
                <button id="addproattr" type="button" class="btn bg-orange col-sm-offset-1 col-md-offset-1">添加属性</button>
                <script>
                  $('#addproattr').on('click',function(){
                    window.location.href='/admin/productattr/{{$data->product_id}}';
                  });
                </script>
              </div>
              -->
              <br>
              <div class="row">
                <button id="listproattr" class="btn bg-purple col-sm-offset-1 col-md-offset-1">属性列表</button>
                <script>
                  $('#listproattr').on('click',function(){
                    $('#main_form').attr('action','/admin/productattrlist/{{$data->product_id}}');
                  });
                </script>
              </div>
              <!--
              <div style="border:1px solid blue;">
                <br>

                <div class="form-group">
                  <label for="selectcolor" class="col-sm-2 col-md-2 control-label">色系：</label>
                  <div id="colordiv" class="col-sm-2 col-md-offset-1" style="background:pink;width:30px;height:30px;border:1px solid black"></div>
                </div>
                <div class="form-group">
                    <label for="" class="col-sm-2 col-md-2 control-label" name="">尺寸/库存：</label>
                </div>
                <div class="form-group">
                  <label for="" class="col-sm-2 col-md-2 control-label"></label>
                  <div class="col-sm-2 col-md-1">
                    24.0
                  </div>
                  <div class="col-sm-8 col-md-7">
                    <input type="text" name="attr_stocknum[]" value="0"/>
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 col-md-2 control-label">轮播图片：</label>
                  <div class="col-sm-2 col-md-2">
                    <img src="{{asset('uploads/product/logo_pic/14669565355217.jpg')}}" style="width:100px;height:100px;border:1px solid gray;"/>
                    <input type="file"/>
                  </div>
                  <div class="col-sm-2 col-md-2">
                    <img src="{{asset('uploads/product/logo_pic/14669565355217.jpg')}}" style="width:100px;height:100px;border:1px solid gray;"/>
                    <input type="file"/>
                  </div>
                  <div class="col-sm-2 col-md-2">
                    <img src="{{asset('uploads/product/logo_pic/14669565355217.jpg')}}" style="width:100px;height:100px;border:1px solid gray;"/>
                    <input type="file"/>
                  </div>
                  <div class="col-sm-2 col-md-2">
                    <img src="{{asset('uploads/product/logo_pic/14669565355217.jpg')}}" style="width:100px;height:100px;border:1px solid gray;"/>
                    <input type="file"/>
                  </div>
                </div>
              </div>
              -->

              <div class="box-footer">
                <input type="reset" class="btn btn-default col-sm-2 col-sm-offset-2 col-md-2 col-md-offset-2" value="清空"/>
                <button class="btn btn-info col-xs-offset-1 col-sm-2 col-sm-offset-1 col-md-2 col-md-offset-1">提交</button>
              </div>
            </form>
            <!-- /.form -->
          </div>
   
        <!-- /.box -->
	    </div>
    </div>
</section>
<!-- /.content -->
@stop